package com.train.streamreceive.rabbitSend;

import com.train.streamreceive.sinks.Sink1;
import com.train.streamreceive.sinks.Sink2;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.annotation.StreamListener;
import org.springframework.cloud.stream.messaging.Sink;
import org.springframework.messaging.Message;

@EnableBinding(Sink2.class)
@Slf4j
public class GetMessage2Impl implements GetMessage{
    @Value("${server.port}")
    private String port;

    @Override
    @StreamListener(Sink2.INPUT)
    public void getInfo(Message<String> message) {
        String info = message.getPayload();
        log.warn("GetMessage2:"+port+" "+info);
    }
}
